using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The FeeTypeCodeTableManager class is responsible for managing BO.FeeTypeCodeTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class FeeTypeCodeTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all FeeTypeCodeTable objects in the database.
/// </summary>
/// <returns>A list with all FeeTypeCodeTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static FeeTypeCodeTableList GetList(){
return FeeTypeCodeTableDB.GetList();
}

/// <summary>
/// Gets a single FeeTypeCodeTable from the database without its data.
/// </summary>
/// <param name="feeTypeCode">The FeeTypeCode of the FeeTypeCodeTable in the database.</param>
/// <returns>A FeeTypeCodeTable object when the FeeTypeCode exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static FeeTypeCodeTable GetItem(short feeTypeCode){
return GetItem(feeTypeCode, false);
}

/// <summary>
/// Gets a single FeeTypeCodeTable from the database.
/// </summary>
/// <param name="feeTypeCode">The FeeTypeCode of the FeeTypeCodeTable in the database.</param>
/// <param name="getFeeTypeCodeTableRecords">Determines whether to load all associated FeeTypeCodeTable records as well.</param>
/// <returns>
/// A FeeTypeCodeTable object when the FeeTypeCode exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static FeeTypeCodeTable GetItem(short feeTypeCode, bool getFeeTypeCodeTableRecords){
FeeTypeCodeTable myFeeTypeCodeTable = FeeTypeCodeTableDB.GetItem(feeTypeCode);
return myFeeTypeCodeTable;
}

/// <summary>
/// Saves a FeeTypeCodeTable in the database.
/// </summary>
/// <param name="myFeeTypeCodeTable">The FeeTypeCodeTable instance to save.</param>
/// <returns>The new FeeTypeCode if the FeeTypeCodeTable is new in the database or the existing FeeTypeCode when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static short Save(FeeTypeCodeTable myFeeTypeCodeTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
short feeTypeCodeTableFeeTypeCode = FeeTypeCodeTableDB.Save(myFeeTypeCodeTable);

//  Assign the FeeTypeCodeTable its new (or existing FeeTypeCode).
myFeeTypeCodeTable.FeeTypeCode = feeTypeCodeTableFeeTypeCode;

myTransactionScope.Complete();

return feeTypeCodeTableFeeTypeCode;
}
}

/// <summary>
/// Deletes a FeeTypeCodeTable from the database.
/// </summary>
/// <param name="myFeeTypeCodeTable">The FeeTypeCodeTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(FeeTypeCodeTable myFeeTypeCodeTable){
return FeeTypeCodeTableDB.Delete(myFeeTypeCodeTable.FeeTypeCode);
}

#endregion

}

}
